<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  <th:block th:fragment="tail">
    <!-- 页面动画效果 -->
    <script th:src="@{/assets/lib/wowjs/wow.min.js}"></script>
    <!-- 图片懒加载 -->
    <script th:src="@{/assets/lib/lazysizes/lazysizes.min.js}"></script>
    <script th:src="@{/assets/js/common.js?v={version}(version=${theme.spec.version})}"></script>
    <script th:src="@{/assets/utils/utils.js}"></script>

    <!-- 页面级js start -->
    <th:block th:if="${htmlType == 'index'}">
      <script th:src="@{/assets/js/index.js?v={version}(version=${theme.spec.version})}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'archives'}">
      <script th:src="@{/assets/js/archives.js?v={version}(version=${theme.spec.version})}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'post'}">
      <script th:src="@{/assets/js/post.js?v={version}(version=${theme.spec.version})}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'post'} or ${htmlType == 'journals'} or ${htmlType == 'sheet'}">
      <script th:src="@{/assets/lib/prism/prism.min.js}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'journals'}">
      <script th:src="@{/assets/js/journals.js?v={version}(version=${theme.spec.version})}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'photos'}">
      <script th:src="@{/assets/js/photos.js?v={version}(version=${theme.spec.version})}"></script>
    </th:block>
    <th:block th:if="${htmlType == 'sheet'}">
      <script th:src="@{/assets/lib/draggabilly/draggabilly.min.js}"></script>
      <script th:src="@{/assets/js/leaving.js}"></script>
    </th:block>
    <!-- 页面级js end -->

    <!-- 轮播图 -->
    <th:block th:if="${htmlType == 'index' && theme.config.carousel.enable_banner}">
      <script th:src="@{/assets/lib/swiper/swiper.min.js}"></script>
    </th:block>
    <!-- 顶部大图 -->
    <th:block th:if="${theme.config.beauty.enable_big_banner}">
      <script th:src="@{/assets/js/beauty.js}"></script>
      <script th:inline="javascript">
        new EvanBigBanner({
          followMode: false,                       // 跟随模式
          followTheme: false,                      // 跟随主题
          titlePrint: true,                        // 是否启用打字机效果
          titlePrintInterval: 300,                 // 打字机速度
          titleTiktok: false,                      // 标题文字抖音效果
          titleText: /*[[${(theme.config.beauty.big_banner_title != null and theme.config.beauty.big_banner_title != '') ? theme.config.beauty.big_banner_title : site.title}]]*/ "",    // 标题文字
          titleColor: "#ffffff",                   // 标题文字颜色
          titleShadow: "-3px 2px 6px #1c1f21",     // 标题文字阴影
          hitokotoParams: {},                      // 一言参数，参考：https://developer.hitokoto.cn/sentence/#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0
          hitokotoApi: "https://v1.hitokoto.cn",   // 一言API
          hitokotoColor: "#ffffff",                // 一言文字颜色
          hitokotoEnable: true                     // 是否使用一言
        });
      </script>
    </th:block>
    <!-- 播放器 -->
    <th:block
      th:if="${theme.config.aside.enable_aside} and ${theme.config.aside.enable_music_player && theme.config.aside.music_id != null && theme.config.aside.music_id != ''}"
    >
      <link rel="stylesheet" th:href="@{/assets/lib/APlayer/APlayer.min.css}">
      <script th:src="@{/assets/lib/APlayer/APlayer.min.js}"></script>
      <script th:src="@{/assets/lib/meting/meting.min.js}"></script>
    </th:block>
    <!-- 文章TOC目录 -->
    <th:block th:if="${htmlType == 'post'} and ${theme.config.post.enable_toc == true}">
      <script th:src="@{/assets/lib/tocbot/tocbot.min.js}"></script>
    </th:block>
    <!-- 文章页音乐播放器、二维码 -->
    <th:block th:if="${htmlType == 'post'}">
      <link rel="stylesheet" th:href="@{/assets/lib/APlayer/APlayer.min.css}">
      <script th:src="@{/assets/lib/APlayer/APlayer.min.js}"></script>
      <script th:src="@{/assets/lib/jquery-qrcode/jquery.qrcode.min.js}"></script>
    </th:block>
    <!-- 相册瀑布流 -->
    <th:block th:if="${htmlType == 'photos'}">
      <script th:src="@{/assets/lib/justifiedGallery/justifiedGallery.min.js}"></script>
    </th:block>

    <!-- 文本复制 -->
    <th:block th:if="${htmlType == 'post'} or ${htmlType == 'journals'} or ${htmlType == 'sheet'}">
      <script th:src="@{/assets/lib/clipboard/clipboard.min.js}"></script>
      <script th:src="@{/assets/lib/qmsg/qmsg.js}"></script>
    </th:block>

    <!-- 图片查看 -->
    <th:block th:if="${htmlType == 'post'} or ${htmlType == 'journals'} or ${htmlType == 'photos'}">
      <script th:src="@{/assets/lib/fancybox/jquery.fancybox.min.js}"></script>
    </th:block>

    <!-- 卜算子 -->
    <th:block th:if="${theme.config.footer.enable_footer and theme.config.footer.enable_busuanzi}">
      <script th:src="@{/assets/lib/busuanzi/busuanzi.min.js}"></script>
    </th:block>

    <th:block th:if="${theme.config.aside.show_newreply == true} or ${htmlType == 'sheet'}">
      <script th:src="@{/assets/lib/j-marked/marked.min.js}"></script>
    </th:block>

    <script th:src="@{/assets/js/custom.js}"></script>

    <!-- 自定义js -->
    <th:block th:if="${theme.config.custom.custom_js_body != null} and ${theme.config.custom.custom_js_body != ''}">
      <script type="text/javascript" th:inline="javascript">/*[[${theme.config.custom.custom_js_body}]]*/</script>
    </th:block>

    <!--搜索点击-->
    <script>
      const searchButton = document.getElementById('halo-search');
      searchButton.addEventListener("click", function () {
        SearchWidget.open();
      });
    </script>

    <th:block th:if="${htmlType == 'photos'}">
      <script type="text/javascript">
        document.querySelector('#sortable').sortablejs();
      </script>
    </th:block>
  </th:block>
</html>
